<!-- top -->
<header class="top-nav">
                <div class="top-nav-inner">
                    <div class="nav-header">
                        <button type="button" class="navbar-toggle pull-left sidebar-toggle" id="sidebarToggleSM">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        
                        <ul class="nav-notification pull-right">
                            <li>
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog fa-lg"></i></a>
                                <span class="badge badge-danger bounceIn">1</span>
                                <ul class="dropdown-menu dropdown-sm pull-right user-dropdown">                 
                                    <li>
                                        <a href="javascript:;" data-toggle="modal" data-target="#myModal">修改密码</a>
                                    </li>             
                                    <li>
                                        <a href="{:U('User/logout')}">退出</a>
                                    </li>                 
                                </ul>
                            </li>
                        </ul>
                        
                        <a href="{:U('Task/index')}" class="brand row">
                            <img src="__IMG__/logo2.jpg" style="float:left;margin-top:10px"><span class="brand-name"style="float:left" >科技查新公共服务平台</span>
                        </a>
                    </div>
                    <div class="nav-container">
                        <button type="button" class="navbar-toggle pull-left sidebar-toggle" id="sidebarToggleLG">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <div class="pull-right m-right-sm">
                            <div class="user-block hidden-xs">
                                <a href="#" id="userToggle" data-toggle="dropdown">
                                    <i class="fa fa-users" style="color:#009d93"></i>
                                    <div class="user-detail inline-block">
                                        {:session('user_auth.username')}
                                        <i class="fa fa-angle-down"></i>
                                    </div>
                                </a>
                                <div class="panel border dropdown-menu user-panel">
                                    <div class="panel-body paddingTB-sm">
                                        <ul>
                                            <li>
                                                <a href="#" onclick="showInfo_user()">
                                                    <i class="fa fa-edit fa-lg "></i><span class="m-left-xs" >个人资料</span>
                                                </a>
                                                <a href="#" data-toggle="modal" data-target="#myModal5">
                                                    <i class="fa fa-edit fa-lg"></i><span class="m-left-xs">修改密码</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="{:U('User/logout')}">
                                                    <i class="fa fa-power-off fa-lg"></i><span class="m-left-xs">退出</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <ul class="nav-notification">
                                <li><a href="{:U('Desk/index')}"  title="主页" target="_blank"><i class="fa fa-home fa-lg" style="font-size:1.5em"></i>&nbsp;&nbsp;委托主页</a></li>
                            </ul>
                        </div>
                    </div>
                </div><!-- ./top-nav-inner -->  
            </header>
<!-- Modal -->
<div class="modal fade" id="myModal5" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"  style="margin-top: 80px">
    <div class="modal-dialog chery_dialog" role="document">
        <div class="modal-content" style="width: 520px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">修改密码</h4>
            </div>
            <form  name="xiugai" >
                <div class="modal-body" style="padding-left:70px;">
                    <div class="right-panel-main">
                        <div class="down-x">
                            <div style="display:none" id="mimaxiugai1" class="error">&nbsp&nbsp请输入原始密码</div>
                            <div style="display:none" id="mimaxiugai2" class="error">&nbsp&nbsp请输入新密码</div>
                            <div style="display:none" id="mimaxiugai3" class="error">&nbsp&nbsp请输入确认密码</div>
                            <div style="display:none" id="mimaxiugai4" class="error">&nbsp&nbsp新密码与原始密码相同，请重新填写</div>
                            <div style="display:none" id="mimaxiugai5" class="error">&nbsp&nbsp新密码和确认密码不同，请重新填写</div>
                            <p class="w-p1" style="width: 60px;display: inline-block;float: left;text-align: left;line-height: 34px;height: 34px;">原始密码</p>
                            <input type="password" class="form-control" id="oldpassword" placeholder="" name="old" style="width: 300px;float: left;">
                        </div>
                        <div class="clear"></div>
                        <div class="down-x">
                            <p class="w-p1" style="width: 60px;display: inline-block;float: left;text-align: left;line-height: 34px;height: 34px;">新密码</p>
                            <input type="password" class="form-control" id="password" placeholder="" name="pwd" style="width: 300px;float: left;">
                        </div>
                        <div class="clear"></div>
                        <div class="down-x">
                            <p class="w-p1" style="width: 60px;display: inline-block;float: left;text-align: left;line-height: 34px;height: 34px;">确认密码</p>
                            <input type="password" class="form-control" id="repassword" placeholder="" name="repwd" style="width: 300px;float: left;">
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="modal-footer" style="text-align:center">
                    <button type="button" class="btn-primarys" onclick="ajax_pwd()" id="sub_button3">确认修改</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!--个人资料-->
<div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top: 80px;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel2">
                    个人资料
                </h4>
            </div>
            <div class="modal-body">
                <div class="main_chaxin_1_2-8">
                    <form action="{:U('User/changeInfo_user')}" method="post" class="form-horizontal form_home5" >
                        <div class="panel-body">
                            <div class="form-group">
                                <!--<label class="col-md-1 control-label">用户名：</label>-->
                                <!--<span class="error" for="client"></span>-->
                                <!--<div class="col-md-3">-->
                                <!--<div class="input-group">-->
                                <!--<span class="input_span"> {:session('user_auth.username')}</span>-->
                                <!--&lt;!&ndash;<input class="form-control1" type="text" id="client"  name="wtrname" value="{$user.wtrname}" required=""  data-msg-required="请输入委托人姓名" />&ndash;&gt;-->
                                <!--</div>-->
                                <!--</div>-->
                                <label class="col-md-1 control-label">姓名：</label>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_name" > </span>-->
                                        <input type="text" placeholder="" id="tel" class="form-control1 userinfo_name" name="name" data-msg-required="请输入联系方式" required=""/>
                                    </div>
                                </div>
                                <label class="col-md-1 control-label">性别：</label>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <span class="input_span userinfo_sex">

                                        </span>

                                    </div>
                                </div>
                            </div>
                            <div class="form-group">

                                <label class="col-md-1 control-label">联系方式：</label>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_phone"> </span>-->
                                        <input type="text" placeholder="手机或固定电话" class="form-control1 userinfo_phone" name="tel"/>
                                    </div>
                                </div>
                                <label class="col-md-1 control-label">邮箱：</label>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_email"></span>-->
                                        <input type="text" placeholder="请填写有效Email地址"  class="form-control1 userinfo_email" name="email"  />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-1 control-label">委托单位： </label>
                                <span class="error" for="company"></span>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_wtdw"></span>-->
                                        <input type="text" placeholder="请正确填写单位全称"  class="form-control1 userinfo_wtdw" name="company"  style="width: 530px;"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-1 control-label">通讯地址：</label>
                                <span class="error" for="address"></span>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_txdz"> </span>-->
                                        <input type="text" placeholder="请正确填写通讯地址"   class="form-control1 userinfo_txdz" name="address" style="width: 530px;"/>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-1 control-label">研究方向：</label>
                                <span class="error" for="address"></span>
                                <div class="col-md-3">
                                    <div class="input-group">
                                        <!--<span class="input_span userinfo_yqfx"> </span>-->
                                        <input type="text" placeholder="请正确填写研究方向"   class="form-control1 userinfo_yqfx" name="user_yqfx" style="width: 530px;"/>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="bs-example" data-example-id="form-validation-states-with-icons">
                            <div class="panel-footer">
                                <div class="row">
                                    <div class="col-sm-8">
                                        <button type="submit" class="action-button ajax-post" style="margin-left: 70%;" target-form="form_home5" >保&nbsp;&nbsp;存</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $().ready(function() {
        toastr.options = {
            "closeButton": false,
            "debug": true,
            "progressBar": true,
            "positionClass": "toast-top-center",
            "showDuration": "400",
            "hideDuration": "1000",
            "timeOut": "7000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }
        // validate signup form on keyup and submit

    });
    //个人信息
    function showInfo_user(){
        $.post("{:U('User/changeInfo')}",{id:1},function(result){
            if(result){
                var html = '';
                $('.userinfo_name').val(result.name);
                if(result.sex == 1){
                   html +=' <input type="radio"  class=" userinfo_sex1" name="user_sex" value=1 checked/>男';
                    html+='<input type="radio"  class=" userinfo_sex2" name="user_sex" value=2 />女';

                }else{
                    html+=' <input type="radio"  class=" userinfo_sex1" name="user_sex" value=1 />男&nbsp;';
                    html+='<input type="radio"  class=" userinfo_sex2" name="user_sex" value=2  checked/>女';
                }
                $('.userinfo_sex').html(html);
                $('.userinfo_phone').val(result.tel);
                $('.userinfo_yzbm').val(result.code);
                $('.userinfo_email').val(result.email);
                $('.userinfo_wtdw').val(result.company);
                $('.userinfo_txdz').val(result.address);
                $('.userinfo_yqfx').val(result.user_yqfx);
//                $('.userinfo_wtdw').text(result.Company);
                $('#myModal4').modal('show')
            }
        })
    }

    //个人资料修改
    function form_user(){
        $('#sub_button2').text('请稍后---').attr('disabled',true);
        var arr = {};
        arr['name']                 = $('input[name="name"]').val();
        arr['tel']                  = $('input[name="tel"]').val();
        arr['email']                = $('input[name="email"]').val();
        arr['company']              = $('input[name="company"]').val();
        arr['address']              = $('input[name="address"]').val();
        arr['user_yqfx']            = $('input[name="user_yqfx"]').val();
        arr['sex']                  = $('input[name="user_sex"]:checked').val();
        $.post("{:U('User/changeInfo_user')}", {sign:arr}, function(r){
            if(r.result == 1){
                toastr.success('执行信息','修改成功');
                setTimeout(function(){
                    location.reload();
                },1500);
            }else{
                $('#sub_button2').text('保 存').attr('disabled',false);
                toastr.error(r.msg,'修改失败');
            }
        });
    }

    //个人密码修改
    function ajax_pwd(){
        $('#sub_button3').prop('disabled',true);
        var arr = {};
        arr['old']      = $('input[name="old"]').val();
        arr['pwd']      = $('input[name="pwd"]').val();
        arr['repwd']    = $('input[name="repwd"]').val();
        $.post("{:U('User/changePwd')}", {pwd:arr}, function(r){
            if(r.result == 1){
                toastr.success('执行信息','修改成功');
                setTimeout(function(){
                    $('#sub_button3').prop('disabled',false);
                    window.location.href = "{:U('User/logout')}";
                },1500);
            }else{
                toastr.error(r.msg,'修改失败');
                setTimeout(function(){
                    $('#sub_button3').prop('disabled',false);
                },1500);
            }
        });
    }
</script>